﻿// =================================================================== 
// 项目说明
//====================================================================
// iMaker.Library@Copy Right 2006-2011
// 文件： ResourceManage.cs
// 项目名称：公共类库，资源文件调用类
// 创建时间：2010-12-26
// 创建人：Jack
// 修改人：
// 修改说明：
// 修改时间：
// ===================================================================
using System;
using System.Resources;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HKEA.CMS.Core.Utility;

namespace HKEA.CMS.Core.Utility
{
    public class ResourceManage
    {
        public ResourceManage()
        {
        }

        public static string GetResourcePath()
        {
            string path = Constant.PathInfo.Resource_Path_ZH_CN.ToString();
            string strLanguage = Common.LanguageInfo.GetLanguage();
            if (strLanguage != null)
            {
                switch (strLanguage)
                {
                    case "zh-cn":
                        path = Constant.PathInfo.Resource_Path_ZH_CN;
                        break;
                    case "en-us":
                        path = Constant.PathInfo.Resource_Path_EN_US;
                        break;
                    case "zh-hk":
                        path = Constant.PathInfo.Resource_Path_ZH_HK;
                        break;
                    default:
                        break;
                }
            }
            return path;
        }

        /// <summary>
        /// 得到指定资源文件的方法
        /// </summary>
        /// <param Name="strKey">键值</param>
        /// <returns>从资源文件读取的结果</returns>
        public static string GetResourceString(string strKey)
        {
            System.Resources.ResourceManager rsMa = new System.Resources.ResourceManager(GetResourcePath(), System.Reflection.Assembly.Load("HKEA.CMS.Core"));
            return rsMa.GetString(strKey);
        }
    }
}
